package com.jp.knowledge.my.activity;

import com.jiayen.util.ToasUtil;
import com.jp.knowledge.R;
import com.jp.knowledge.my.resources.OrganizeJoinRes;

/**
 * 加入学校
 */
public class JoinSchoolActivity extends JoinOrganizeCommActivity {
    @Override
    protected void itemClick(int index) {
        intent.putExtra(OrganizeJoinRes.REQUEST_CODE, OrganizeJoinRes.SCHOOL_INDEX);
        switch (index) {
            case 0:
                intent.setClass(JoinSchoolActivity.this, SearchListActivity.class);
                intent.putExtra(OrganizeJoinRes.TITLE, getString(OrganizeJoinRes.SCHOOL_ITEM_TITLES[0]));
                startActivityForResult(intent, index, null);
                break;
            case 1:
                if(this.itemDetails.get(0).getText().toString().trim().length() == 0) {
                    ToasUtil.toast(JoinSchoolActivity.this, R.string.toast_choose_school_first);
                    break;
                }
                intent.setClass(JoinSchoolActivity.this, DepartmentActivity.class);
                intent.putExtra(OrganizeJoinRes.TITLE, getString(OrganizeJoinRes.SCHOOL_ITEM_TITLES[1]));
                startActivityForResult(intent, index, null);
                break;
            case 2:
                if(this.itemDetails.get(1).getText().toString().trim().length() == 0) {
                    ToasUtil.toast(JoinSchoolActivity.this, R.string.toast_choose_college_first);
                    break;
                }
                intent.setClass(JoinSchoolActivity.this, ClassActivity.class);
                intent.putExtra(OrganizeJoinRes.DEPA_ID, depaId);
                intent.putExtra(OrganizeJoinRes.TITLE, getString(OrganizeJoinRes.SCHOOL_ITEM_TITLES[2]));
                startActivityForResult(intent, index, null);
                break;
            case 3:
                intent.setClass(JoinSchoolActivity.this, OptionSchoolTimeActivity.class);
                intent.putExtra(OrganizeJoinRes.TITLE, getString(OrganizeJoinRes.SCHOOL_ITEM_TITLES[3]));
                startActivityForResult(intent, index, null);
                break;
            default:
                return;
        }
    }
}
